package data;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class CheckRepeat {
    PreparedStatement pstmt = null;
    public boolean checkrepeat(Connection con,String username) throws Exception{
        String sql = "select count(*) from user where username=?";
        pstmt=con.prepareStatement(sql);
        pstmt.setString(1,username);
        ResultSet rs = pstmt.executeQuery();
        rs.next();
        int count = rs.getInt(1);
        if(count > 0){
            return true;
        }
        return false;
    }
}
